package midtool;
import java.io.File;
import java.io.IOException;

import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;

import org.jfugue.midi.MidiParser;
import org.jfugue.pattern.Pattern;
import org.jfugue.player.Player;
import org.staccato.StaccatoParserListener;

public class midParser {
    public static void main(String[] args) throws InvalidMidiDataException, IOException {
        MidiParser parser = new MidiParser();
        StaccatoParserListener listener = new StaccatoParserListener();
        parser.addParserListener(listener);
        String pathname = "C:\\0wkspc\\dinsyohwer.mid";
        pathname="C:\\0log\\atifirstmid2018-05-04 16_58_56_735.mid";
		parser.parse(MidiSystem.getSequence(new File(pathname)));
        Pattern staccatoPattern = listener.getPattern();
        System.out.println(staccatoPattern);

        Player player = new Player();
        player.play(staccatoPattern);
    }
}